from alg import Solution
from gen import test_data

solution = Solution()



def max_str_main():
    data = test_data['max_str']
    print("s: {}".format(data[0]))
    print("t: {}".format(data[1]))
    print("The max length of the two string is: {}".format(solution.num_distinct(data[0], data[1])))

    # 测试用例
    # print("s: babgbag")
    # print("t: bag")
    # print("The max length of the two string is: {}".format(solution.num_distinct("babgbag", "bag")))
def isMatch_main():
    for i in range(0, 3):
        print(f"test {i}----------------")
        s = test_data["isMatch"][0][i]
        p = test_data["isMatch"][1][i]
        print(f"assert {s} and {p} can be regular expression matched is{solution.isMatch(s, p)}")
        print(f"assert {s} and {p} can be regular expression matched is{solution.isMatch_lru(s, p)}")

def split_list_main():
    data = test_data['split_list']
    print("The list is: {}".format(data))
    print("The min number of the list you can split to: {}".format(solution.splitArray(data)))

def test_main():
    data_nums = test_data['nums']
    data_m = test_data['m']
    min_max = solution.splitArray1(data_nums, data_m)
    print('nums:', data_nums)
    print('m:', data_m)
    print('min_max:', min_max)
    
def shortest_common_supersequence_main():
    str1 = test_data["str1"]
    str2 = test_data["str2"]
    print("str1: {}".format(str1))
    print("str1: {}".format(str2))
    print("common str: {}".format(solution.shortest_common_supersequence(str1,str2)))

if __name__ == '__main__':
    max_str_main()
    isMatch_main()
    split_list_main()
    test_main()
    shortest_common_supersequence_main()
